package com.example.safeassistan.home.adapter;

import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.home.model.InvestigationModel;
import com.example.safeassistan.risk.model.RiskPointTableDetailModel;

import java.util.List;

public class HiddenDangerInvestigationChildAdapter extends BaseQuickAdapter<InvestigationModel.ResultDTO.ChildrenDTO,BaseViewHolder> {
    private StringBuilder stringBuilder;
    public HiddenDangerInvestigationChildAdapter(@Nullable List<InvestigationModel.ResultDTO.ChildrenDTO> data) {
        super(R.layout.item_checktable_investigationc, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, InvestigationModel.ResultDTO.ChildrenDTO item) {
        helper.setText(R.id.tvId,(helper.getPosition()+1)+"、");
        if (item.getItemDescList()!=null&&item.getItemDescList().size()>0){
            stringBuilder=new StringBuilder();
            for (int i=0;i<item.getItemDescList().size();i++){
                //遍历
                stringBuilder.append((helper.getPosition()+1)+"."+(i+1)+"、"+item.getItemDescList().get(i)+"\n");
            }
            helper.setText(R.id.tvContent,stringBuilder);
        }else {
            helper.setText(R.id.tvContent,item.getItemDesc());
        }
    }
}